// pages/navDetail/navDetail.js
var util=require("../../utils/util.js");
var baseImgUrl = util.baseImgUrl;

Page({

  /**
   * 页面的初始数据
   */
  data: {
    showClass:false,
    topList:["新店","热销","特卖"],
    certifyUrl: "../images/certify.png",//已认证图片路径
    uncertifyUrl: "../images/uncertify.png",//未认证图片路径
    hotUrl: "../images/hot.png",//人气图片路径
    positionUrl: "../images/position.png",//距离图片路径
    distance: 5,//测试数据  距离
    followedUrl: "../images/followed.png",//已关注的图片路径
    unfollowUrl: "../images/unfollowed.png",//未关注的图片路径
    scanUrl:baseImgUrl+"scan.png",//浏览量图片
    showfujin:false,//是否显示附近选择面板
    shouClass:false,//是否显示选择类别
    activeClass:0,//选中的类别
    shoplist: [{
      shopid: 1,
      xuhao: 1,
      shoplogo: "../images/bang.png",
      shopname: "巴黎欧莱雅徐州总店",
      certify: true,
      hotNum: 1520,
      latitude: "35.0125",
      longitude: "117.35632",
      followFlag: true,
      picrul: [{
        url: baseImgUrl+"goods1.png",
        price: "56"
      }, {
          url: baseImgUrl + "goods1.png",
        price: "50"
      }, {
          url: baseImgUrl + "goods2.png",
        price: "9.9"
      }
      ]
    }, {
      shopid: 2,
      xuhao: 2,
      shoplogo: "../images/bang.png",
      shopname: "巴黎欧莱雅徐州2店",
      certify: false,
     
      hotNum: 1500,
      latitude: "35.0125",
      longitude: "117.35632",
      followFlag: false,
      picrul: [{
        url: baseImgUrl +"goods1.png",
        price: "56"
      }, {
          url: baseImgUrl +"goods1.png",
        price: "30"
      }, {
          url: baseImgUrl +"goods2.png",
        price: "9.9"
      }
      ]
    }, {
      shopid: 1,
      xuhao: 3,
      shoplogo: "../images/bang.png",
      shopname: "巴黎欧莱雅徐州总店",
      certify: true,
      cerbifyUrl: "../images/certify.png",
      hotNum: 1520,
      latitude: "35.0125",
      longitude: "117.35632",
      followFlag: true,
      picrul: [{
        url: baseImgUrl +"goods2.png",
        price: "56"
      }, {
          url: baseImgUrl +"goods2.png",
        price: "50"
        }, {
          url: baseImgUrl +"goods2.png",
          price: "50"
        }
      ]
    }, {
      shopid: 2,
      xuhao: 4,
      shoplogo: "../images/bang.png",
      shopname: "巴黎欧莱雅徐州2店",
      certify: false,
      cerbifyUrl: "../images/uncertify.png",
      hotNum: 1500,
      latitude: "35.0125",
      longitude: "117.35632",
      followFlag: false,
      picrul: [{
        url: baseImgUrl +"goods1.png",
        price: "56"
      }, {
          url: baseImgUrl +"goods1.png",
        price: "30"
      }, {
          url: baseImgUrl +"goods1.png",
        price: "9.9"
      }
      ]
    }],
    goodslist:[{
        id:0,
        goodsUrl:baseImgUrl+"goods1.png",
        goodsname:"女友礼物精选集",
      content:"商品的介绍内容品的介绍内容商品的介绍内容商品的介绍内容s",
        biaoqian:["今日秒杀","HOT热卖","特卖"],
        price:45,
        scanNum:1234,
        scanUrl: baseImgUrl + "scan.png",
    },{
        id: 1,
        goodsUrl: baseImgUrl + "goods2.png",
        goodsname: "女友礼物精选集",
        content: "商品的介绍内容",
        biaoqian: ["今日秒杀"],
        price: 95,
        scanNum: 1200,
        scanUrl: baseImgUrl + "scan.png",
      }, {
        id: 2,
        goodsUrl: baseImgUrl + "goods2.png",
        goodsname: "女友礼物精选集",
        content: "商品的介绍内容商",
        
        price: 125,
        scanNum: 1000,
        scanUrl: baseImgUrl + "scan.png",
      }, {
        id: 3,
        goodsUrl: baseImgUrl + "goods2.png",
        goodsname: "女友礼物精选集",
        content: "商品的介绍内容商品的介绍内容商品的介绍内容商品的介绍内容",
        biaoqian: ["今日秒杀", "HOT热卖", "特卖"],
        price: 125,
        scanNum: 1000,
        scanUrl: baseImgUrl + "scan.png",
      },  {
        id: 4,
        goodsUrl: baseImgUrl + "goods2.png",
        goodsname: "女友礼物精选集",
        content: "商品的介绍内容商",
        biaoqian: ["今日秒杀", "特卖"],
        price: 125,
        scanNum: 1000,
        scanUrl: baseImgUrl + "scan.png",
      }, {
        id: 5,
        goodsUrl: baseImgUrl + "goods2.png",
        goodsname: "女友礼物精选集",
        content: "商品的介绍内容商品的介绍内容商品的介绍内容商品的介绍内容",
         biaoqian:["今日秒杀","HOT热卖",],
        price: 125,
        scanNum: 1000,
        scanUrl: baseImgUrl + "scan.png",
      }],
    fujinList:[{
      id:0,
      name:"离我最近",
      num:50
    }, {
        id: 1,
        name: "鼓楼区",
        num: 88
      }, {
        id: 2,
        name: "云龙区",
        num: 150
      }, {
        id: 3,
        name: "泉山区",
        num: 23
      }, {
        id: 4,
        name: "贾汪区",
        num: 23
      }],
    classList:[{
      id:0,
      name:"全部"
    },{
        id: 1,
        name: "营养保健"
      }, {
        id: 2,
        name: "个人洗护"
      }, {
        id: 4,
        name: "母婴"
      }, {
        id: 1,
        name: "营养保健"
      }, {
        id: 2,
        name: "个人洗护"
      }, {
        id: 4,
        name: "母婴"
      }]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options);
    var that = this;
    var activeIndex=options.index-1;
    that.setData({
      activeIndex: activeIndex
    })

  },
  loading:function(){
    wx.showLoading({
      title: '正在加载中...',
    })
    setTimeout(function(){
      wx.hideLoading();
    },600)
  },

  /******点击导航条***** */
  choseNav:function(e){
    var that=this;
    var activeIndex=e.currentTarget.dataset.index;
    that.setData({
      activeIndex:activeIndex
    })
    //请求数据
    that.loading();
  },
  /**********点击附近按钮*********** */
  showfujin:function(){
    var that=this;
    that.setData({
      showfujin:true
    })
  },
  // 隐藏附近面板
  hidefujin:function(){
    var that = this;
    that.setData({
      showfujin: false
    })
  },
  /*********选择地区****** */
  choseDist:function(e){
    console.log(e);
    var that=this;
    var this_id=e.currentTarget.dataset.id;
    //请求数据，刷新页面

    that.setData({
      showfujin: false
    })
   },
  /**********选择标签*********** */
  showClasses:function(){
      var that=this;
      that.setData({
        showClass:true
      })
  },

 /*********隐藏标签*************/
  hideGrey:function(){
      var that=this;
    that.setData({
      showClass: false,
      showfujin:false
    })
  },
  /*********选择匪类**********/
  choseClass:function(e){
    var that=this;
    var activeClass=e.currentTarget.dataset.index;
      that.setData({
        activeClass: activeClass
      })
      setTimeout(function(){
        that.setData({
          showClass: false
        })
      },100)

      //请求接口，获取数据

  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    var that=this;
    var arr=[];
    wx.showLoading({
      title: '玩儿命加载中...',
    })
    setTimeout(function () {
      wx.hideLoading()
      arr = arr.concat(that.data.shoplist);
      console.log(arr);
      //测试数据
      var arr_lishi = that.data.shoplist;

      arr = arr.concat(arr_lishi)
      console.log(arr);
      that.setData({
        shoplist: arr
      })
    }, 1000)
  },

  /********guanzu****** */
  guanzhu:function(e){
    console.log(e);
    var shopid=e.currentTarget.dataset.shopid;
    var that=this;
    that.setData({

    })
    
  },
  quxiaoguanzhu:function(e){
    console.log(e);
    var shopid = e.currentTarget.dataset.shopid;
    var that = this;
    wx.showModal({
      title: '',
      content: '确认取消关注',
      cancelColor:"#666",
      confirmColor:"#ff1313",
      confirm:function(e){
          //请求接口，刷新数据
      },
      cancel:function(){

      }


    })
    // that.setData({

    // })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
})